package Test;

import java.util.Scanner;

public class Test4 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数字  ");
        int n = scanner.nextInt();
        int [] ch = {1,2,4,3,2,1,1,2,3};
        //int [] ch = new int[n+1];
       /* for (int i = 0; i < n; i++) {
            ch[i] = scanner.nextInt();
        }*/

       int i = 0;
       int count = 0;
       while(i < n-1){
           if(ch[i] < ch[i+1]){
               while(i < n-1 && ch[i] < ch[i+1]){
                   i++;
               }
               count++;
               i++;
           }else if(ch[i] == ch[i+1]){
               i++;
           }else{
               if(ch[i] > ch[i+1]){
                   while(i < n-1 && ch[i] > ch[i+1]){
                       i++;
                   }
                   count++;
                   i++;
               }
           }
       }
        System.out.println(count);
    }
}
